{extend name="platform/base" /}
{block name="resources"}
<!-- <link rel="stylesheet" type="text/css" href="ADMIN_CSS/haidao.css"> -->
<!-- <link rel="stylesheet" type="text/css" href="ADMIN_CSS/admin.css"> -->
<style>
.btn-test{
	font-family: "microsoft yahei";
	border-radius: 4px;
	padding: 5px 20px;
	background-color: #51A351;
	color: #FFF;
	margin: 0 10px;
	border: none;
}
.table-logo{display:inline-block;width:75px;float:left;}
.table-pay{display:inline-block;width:590px;overflow:hidden;margin-top: 7px;}
.table-desc{display:inline-block;width:590px;overflow:hidden;}
.table tr {
    min-height: 40px;
    height: 40px;
    font-size: 12px;
}
.table-desc {
    margin-top: 7px;
}
</style>
{/block}
{block name="main"}
<!-- 邮箱设置 -->
<div class="set-style">
	<div class="tab-pane active">
		<table class="table table-striped table-main" border="0">
			<colgroup>
				<col width="70%">
				<col width="15%">
				<col width="15%">
			</colgroup>
			<tbody>
				<tr class="table-title" style="background: white;z-index: 10;border: 1px solid #E3E3E3;">
					<th class="tal">支付方式</th>
					<th style="text-align: center;">状态</th>
					<th style="text-align: center;">操作</th>
				</tr>
			</tbody>
			<tbody>
				{volist name="pay_list" id="pay_obj"}
					<tr>
					     <td>
					         <div class="table-logo"><img src="__ROOT__/{$pay_obj.logo}"/></div>
					         <span class="table-pay">{$pay_obj.pay_name}</span>
					         <span class="table-desc">{$pay_obj.desc}</span> 
					     </td>
					     {if condition="$pay_obj.is_use eq 1"}
					     	<td style="text-align: center;line-height:59px;"><a href="javascript:;" class="pay-start" status =1 onclick="set_status('{$pay_obj.key}', this)"><img src="__ROOT__/public/admin/images/start.png" /></a></td>
					     {else/}
					     	<td style="text-align: center;line-height:59px;"><a href="javascript:;" class="pay-close" status =0 onclick="set_status('{$pay_obj.key}', this)"><img src="__ROOT__/public/admin/images/close.png" /></a></td>
						 {/if}					     	
					     <td style="text-align: center;line-height:59px;">
					     	{if condition="$pay_obj.key eq 'WPAY'"}
					  			<a href="{:__URL('PLATFORM_MAIN/config/payconfig?type=wchat#wpay')}">配置</a>
					  		{else/}
					  			<a href="{:__URL('PLATFORM_MAIN/config/payaliconfig')}">配置</a>
							{/if}					  		  
					  	</td>
					</tr>
				{/volist}
			</tbody>
		</table>
	</div>
								
</div>
<script>

function set_status(type,event){
	var status = $(event).attr('status');
	if(status == 1)
	{
		var change_status = 0;
	}
	else{
		var change_status = 1;
	}
	$.ajax({
		type : "post",
		url : "{:__URL('PLATFORM_MAIN/config/setstatus')}",
		data : {
			'is_use' : change_status,
			'type' : type
		},
		async : true,
		success : function(data) {
			if (data["code"] > 0) {
				if(status == 1)
				{
					$(event).attr('status', 0);
					$(event).find('img').attr('src', '__ROOT__/public/admin/images/close.png');
					
				}else{
					$(event).attr('status', 1);
					$(event).find('img').attr('src', '__ROOT__/public/admin/images/start.png');
				}
				showMessage('success', data["message"]);
			}else{
				showMessage('error', data["message"]);
			}	
			flag = false;
		}
	});
   

}


</script> 



{/block}